package com.qumitech.visualnovel.datasource.console;

import com.qumitech.visualnovel.controller.vo.statics.AccountPayStaticsVO;
import com.qumitech.visualnovel.model.dao.console.AccountLogin;
import com.qumitech.visualnovel.pubdef.dto.associate.AssociateAccountDTO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

public interface AccountLoginMapper {
    int deleteByPrimaryKey(Long id);

    int insert(AccountLogin record);

    int insertSelective(AccountLogin record);

    AccountLogin selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AccountLogin record);

    int updateByPrimaryKey(AccountLogin record);

    List<HashMap<String, Object>> getRewordAccount(@Param("tableNameList") List<String> tableNameList,
                                                   @Param("appId") String appId,
                                                   @Param("startTime") String startTime,
                                                   @Param("endTime") String endTime);

    List<AccountLogin> getList(@Param("accountId") Integer accountId,
                               @Param("startTime") String startTime,
                               @Param("endTime") String endTime,
                               @Param("appId") String appId,
                               @Param("offset") int offset,
                               @Param("pageSize") int pageSize,
                               @Param("orderBy") String orderBy,
                               @Param("orderType") String orderType,
                               @Param("tableNames") List<String> tableNames);

    int getCount(@Param("accountId") Integer accountId,
                 @Param("startTime") String startTime,
                 @Param("endTime") String endTime,
                 @Param("appId") String appId,
                 @Param("tableNames") List<String> tableNames);

    List<HashMap<String, String>> getRank(@Param("tableNameList") List<String> tableNameList,
                                          @Param("dimension") String dimension,
                                          @Param("startTime") String startTime,
                                          @Param("endTime") String endTime);

    List<AssociateAccountDTO> listAccountByDimension(@Param("tableNameList") List<String> tableNameList,
                                                     @Param("dimension") String dimension,
                                                     @Param("dimensionValue") String dimensionValue,
                                                     @Param("startTime") String startTime,
                                                     @Param("endTime") String endTime,
                                                     @Param("orderType") String orderType,
                                                     @Param("orderBy") String orderBy,
                                                     @Param("offset") Integer offset,
                                                     @Param("limit") Integer limit);

    int countAccountByDimension(@Param("tableNameList") List<String> tableNameList,
                                @Param("dimension") String dimension,
                                @Param("dimensionValue") String dimensionValue,
                                @Param("startTime") String startTime,
                                @Param("endTime") String endTime);


    List<HashMap<String, String>> listRankByDimension(@Param("tableNameList") List<String> tableNameList,
                                                      @Param("dimension") String dimension,

                                                      @Param("startTime") String startTime,
                                                      @Param("endTime") String endTime,
                                                      @Param("orderType") String orderType,
                                                      @Param("orderBy") String orderBy,
                                                      @Param("offset") Integer offset,
                                                      @Param("limit") Integer limit);

    int countRankByDimension(@Param("tableNameList") List<String> tableNameList,
                             @Param("dimension") String dimension,

                             @Param("startTime") String startTime,
                             @Param("endTime") String endTime);


    List<String> getDeviceIdByAccountId(@Param("tableNameList") List<String> tableNameList,
                                        @Param("startTime") String startTime,
                                        @Param("endTime") String endTime,
                                        @Param("accountId") Long accountId);

    List<String> getDeviceIdByAccountIdList(@Param("tableNameList") List<String> tableNameList,
                                            @Param("startTime") String startTime,
                                            @Param("endTime") String endTime,
                                            @Param("accountIds") Long[] accountIds);

    List<AccountPayStaticsVO> countActive(@Param("tableName") String tableName, @Param("dayStart") Date dayStart,
                                          @Param("dayEnd") Date dayEnd);
}